//
//  YGArrow.m
//  FlyGift
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "YGArrow.h"
/**
 *  向下小箭头的继承button的类
 */
@implementation YGArrow
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setImage:[UIImage imageNamed:@"Arrow"] forState:0];
        [self setImage:[UIImage imageNamed:@"Arrow"] forState:1 <<  0];
        self.backgroundColor = KColor(238, 238, 238, 1);
        [self addTarget:self action:@selector(arrowClickAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

- (void)arrowClickAction
{
    if (self.arrowBtnClickBlock)
    {
        self.arrowBtnClickBlock();
    }
}

/**
 *  可以设置图片的大小
 */
- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGFloat imageSize = 18;
    return CGRectMake((contentRect.size.width - imageSize) / 2, (30 - imageSize) / 2, imageSize, imageSize);
}

@end
